<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" inline>
      <el-form-item label="状态">
        <el-radio-group v-model="form.status" @change="search">
          <el-radio-button :label="99999999">全部</el-radio-button>
          <el-radio-button :label="0">待完善提交</el-radio-button>
          <el-radio-button :label="3">
            待保险修改
            <span v-if="badgeData.backBx > 0" class="red my-badge">{{
              badgeData.backBx
            }}</span>
          </el-radio-button>
          <el-radio-button :label="4">
            待内勤修改
            <span v-if="badgeData.backNq > 0" class="red my-badge">{{
              badgeData.backNq
            }}</span>
          </el-radio-button>
          <el-radio-button :label="5">
            待财务审核
            <span v-if="badgeData.judge > 0" class="red my-badge">{{
              badgeData.judge
            }}</span>
          </el-radio-button>
          <el-radio-button :label="10">
            已发送出单通知
            <span v-if="badgeData.send > 0" class="red my-badge">{{
              badgeData.send
            }}</span>
          </el-radio-button>
          <el-radio-button :label="20">
            待付款买保险
            <span v-if="badgeData.pay > 0" class="red my-badge">{{
              badgeData.pay
            }}</span>
          </el-radio-button>
          <el-radio-button :label="30">
            待上传保单
            <span v-if="badgeData.upload > 0" class="red my-badge">{{
              badgeData.upload
            }}</span>
          </el-radio-button>
          <!-- <el-radio-button :label="190">
            待复核
            <span v-if="badgeData.check > 0" class="red my-badge">{{
              badgeData.check
            }}</span>
          </el-radio-button> -->
          <el-radio-button :label="200">已完成</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="是否分期">
        <el-radio-group v-model="form.fenqi" @change="search">
          <el-radio-button :label="99999999">不限</el-radio-button>
          <el-radio-button :label="1">是</el-radio-button>
          <el-radio-button :label="0">否</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="是否垫付">
        <el-radio-group v-model="form.dianfu" @change="search">
          <el-radio-button :label="99999999">不限</el-radio-button>
          <el-radio-button :label="1">是</el-radio-button>
          <el-radio-button :label="0">否</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="所属区域">
        <area-radio v-model="form.area_id" @change="search" />
      </el-form-item>
      <br />
      <el-form-item label="车牌号码">
        <el-input v-model.trim="form.plate_number" />
      </el-form-item>
      <el-form-item label="车队名称">
        <el-input v-model.trim="form.company" />
      </el-form-item>
      <el-form-item label="创建人">
        <el-input v-model.trim="form.create_user" />
      </el-form-item>
      <el-form-item label="提交人">
        <el-input v-model.trim="form.to_judge_user" />
      </el-form-item>
      <el-form-item label="审核人">
        <el-input v-model.trim="form.judge_user" />
      </el-form-item>
      <br v-if="form.status == 129730" />
      <el-form-item v-if="form.status == 10" label="开始时间">
        <el-date-picker
          v-model="form.startDate"
          type="date"
          value-format="YYYY-MM-DD"
        />
      </el-form-item>
      <el-form-item v-if="form.status == 10" label="结束时间">
        <el-date-picker
          v-model="form.endDate"
          type="date"
          value-format="YYYY-MM-DD"
        />
      </el-form-item>
      <el-form-item label-width="16px">
        <el-button type="primary" @click="search">查询</el-button>
      </el-form-item>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { useFormData } from '@/utils/use-form-data';

  import AreaRadio from '@/components/AreaRadio/index.vue';
  const emit = defineEmits(['search']);
  const props = defineProps({
    action: String,
    badgeData: Object
  });
  /** 表单数据 */
  const [form] = useFormData({
    company: '',
    area_id: '',
    plate_number: '',
    status: 0,
    startDate: '',
    endDate: '',
    fenqi: 99999999,
    dianfu: 99999999
  });

  /** 搜索 */
  const search = () => {
    console.log(form);
    emit('search', { ...form });
  };
</script>
